package edu.ynu.se.xiecheng.achitectureclass.demo.entity;

import edu.ynu.se.xiecheng.achitectureclass.common.entity.LogicEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.ManyToOne;
import javax.persistence.JoinColumn;

@Getter
@Setter
@Entity
@Table(name = "device")
@Where(clause = "is_deleted = 0")
@ApiModel(description = "设备信息")
public class Device extends LogicEntity {
    @Column(name = "name")
    @ApiModelProperty(value = "设备名称", required = true)
    private String name;

    @Column(name = "serial_number")
    @ApiModelProperty(value = "设备序列号", required = true)
    private String serialNumber;

    @Column(name = "type")
    @ApiModelProperty(value = "设备类型", required = true)
    private String type;

    @Column(name = "unit")
    @ApiModelProperty(value = "设备单位", required = true)
    private String unit;

    @Column(name = "monitoring_address")
    @ApiModelProperty(value = "监控地址", required = true)
    private String monitoringAddress;

    @ManyToOne
    @JoinColumn(name = "greenhouse_id", referencedColumnName = "id")
    @ApiModelProperty(value = "所属温室", required = true)
    private Greenhouse greenhouse;
}